<extend name="Base/common"/>

<block name="style">
<link href="__CSS__/stylesheet.css" rel="stylesheet">
<link href="__CSS__/user.css" rel="stylesheet">
</block>

<block name="header">
<header>
	<include file="User/header" />
</header>
</block>

<block name="body">
<div class="container main">
	<div class="user-main">
		<div class="col-xs-3">
			<include file="User/left_menu" />
		</div>
		<div class="col-xs-9">
			<h5>个人信息</h5>
			<div class="content">
				<form action="__SELF__" class="form-horizontal" enctype="multipart/form-data" autocomplete="off">
					<div class="form-group">
						<label class="label-control">当前头像：</label>
						<div class="input-control">
						<input type="hidden" id="avatar" name="avatar" value="{$info.avatar}" />
						<div class="headpic" ><img  src="{$info.avatar_path}" /></div>
						 	<div  id="headpic"></div>
						</div>
					</div>
					<div class="form-group">
						<label class="label-control">昵称：</label>
						<div class="input-control">
							<input type="text" name="nickname" value="{$info.nickname}" class="form-control" value="">
						</div>
					</div>
					<div class="form-group">
						<label class="label-control">性别：</label>
						<div class="input-control">
							<label class="radio"><input type="radio"
							 <eq value="1"  name="info['sex']">checked=checked</eq> 
							name="sex" value="1">男</label>
							<label class="radio"><input type="radio"
							<eq value="2"  name="info['sex']">checked=checked</eq> 
							 name="sex" value="2">女</label>
						</div>
					</div>
					<div class="form-group">
						<div class="button-control">
							<a href="javascript:;" class="btn ajax-post" target-form="form-horizontal">保存</a>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
</div>
</block>

<block name="script"><!--  -->				
<script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>					
<script type="text/javascript">	
var rootpath="__ROOT__";
//上传图片
/* 初始化上传插件 */
$("#headpic").uploadify({
	  "auto"          : true,
	  "height"          : 60,
      "swf"             : "__STATIC__/uploadify/uploadify.swf",
      "fileObjName"     : "download",
      "buttonText"		: "修改头像",
      "uploader"        : "{:U('File/uploadPicture',array('session_id'=>session_id()))}",
      "width"           : 60,	      
      'removeTimeout'	  :0,
      'fileTypeExts'	  : '*.jpg; *.png; *.gif;',
      "onUploadSuccess" : uploadPicture_panel,
      'onFallback' : function() {
          alert('未检测到兼容版本的Flash.');
      }
   });	   
function uploadPicture_panel(file, data){
   	var data = $.parseJSON(data);
   	src = data.url || "__ROOT__" + data.path;
       if(data.status){
       	$("#avatar").val(data.id);
       	src = data.url || '__ROOT__' + data.path
       	$(".headpic").find('img').attr('src',src);
       } else {
       	updateAlert(data.info);				        	
    }
}
highlight_subnav("{:U('User/index')}");
highlight_leftnav("{:U('User/info')}");
</script>
</block>